package com.atguigu.gulimall.cart.vo;

import java.math.BigDecimal;
import java.util.List;

/**
 * 购物车
 */
public class Cart {
    private List<CartItem> items;
    private Integer countNum; //商品数量
    private Integer countType; //商品类型数量
    private BigDecimal amount;//购物车商品总价
    private BigDecimal reduce; //减免价格

    public List<CartItem> getItems() {
        return items;
    }

    public void setItems(List<CartItem> items) {
        this.items = items;
    }

//    public Integer getCountNum() {
//        int count = 0;
//        if(items!=null&&items.size() > 0){
//            for(CartItem item : items){
//                count+=item.getCount();
//            }
//        }
//        return count;
//    }
//
//
//    public Integer getCountType() {
//        if(items!=null&&items.size() > 0){
//            return items.size();
//        }
//        return 0;
//    }
//
//
//    public BigDecimal getAmount() {
//        BigDecimal amount = new BigDecimal(0);
//        if(items!=null&&items.size() > 0){
//            for(CartItem item:items){
//                amount = amount.add(item.getTotalPrice());
//            }
//        }
//        if(reduce!=null){
//            amount = amount.subtract(reduce);
//        }
//        return amount;
//    }


    public Integer getCountNum() {
        return countNum;
    }

    public void setCountNum(Integer countNum) {
        this.countNum = countNum;
    }

    public Integer getCountType() {
        return countType;
    }

    public void setCountType(Integer countType) {
        this.countType = countType;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public BigDecimal getReduce() {
        return reduce;
    }

    public void setReduce(BigDecimal reduce) {
        this.reduce = reduce;
    }
}
